package com.aaa.mrcai.controller;

import com.aaa.mrcai.annotion.AAALog;
import com.aaa.mrcai.pojo.vo.GoodsGradeVo;
import com.aaa.mrcai.query.GoodsGradeQuery;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.GoodsGradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Demo class
 *
 * @Author: Wang
 * @Date: Created in 19:43 2021/12/6
 */
@RestController
@RequestMapping("goodsGrade")
public class GoodsGradeController {
    @Autowired
    public GoodsGradeService goodsGradeService;

    @RequestMapping("list")
    public AjaxResult list(GoodsGradeQuery query){
        return goodsGradeService.list(query);
    }

    @RequestMapping("addGoodsGrade")
    @AAALog("添加商品等级")
    public AjaxResult addGoodsGrade (GoodsGradeVo goodsGradeVo){
        return goodsGradeService.addGoodsGrade(goodsGradeVo);
    }

    @RequestMapping("/getGoodsGrade/{id}")
    public AjaxResult getGoodsGrade (@PathVariable("id") int id ){
        return goodsGradeService.getGoodsGrade(id);
    }

    @RequestMapping("updateGoodsGrade")
    @AAALog("修改商品等级")
    public AjaxResult updateGoodsGrade (GoodsGradeVo goodsGradeVo){
        return goodsGradeService.updateGoodsGrade(goodsGradeVo);
    }

    @RequestMapping("/deleteGoodsGrade/{id}")
    @AAALog("删除商品等级")
    public AjaxResult deleteGoodsGrade(@PathVariable("id") int id ){ return goodsGradeService.deleteGoodsGrade(id); }

}
